package com.wg.wuge.tulin.jmm;

import java.util.ArrayList;
import java.util.List;

public class TreadTest {

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);


            new Thread(() -> {
                for (int index = 0; index <1000; index ++) {
                    list.set(0, 5);
                    System.out.println("thread name is " + Thread.currentThread().getName() + list);
                }
            }, "s1").start();

            new Thread(() -> {
                for (int index = 0; index <1000; index ++) {
                    list.set(0,55);
                    System.out.println("thread name is " + Thread.currentThread().getName() + list);
                }
            }, "s2").start();

    }
}
